package facebook;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Solution {

	public static void main(String[] args) throws Exception {

		BufferedReader bf = null;
		try {

			bf = new BufferedReader(new InputStreamReader(System.in));

			String line = bf.readLine();
			int n, k;
			String[] t = line.split(" ");
			n = Integer.valueOf(t[0]);
			k = Integer.valueOf(t[1]);

			System.out.println(getIndex(n, k));

		} catch (Exception e) {
			System.out.println("Error: " + e.getMessage());
		} finally {
			if (bf != null) {
				bf.close();
			}
		}

	}

	public static String getIndex(int n, int k) {

		Integer[] array = new Integer[((int) Math.pow(2, n))];
		for (int i = 0; i < array.length; i++) {
			array[i] = i;
		}

		Arrays.sort(array, new FacebookComparator());
		
		return convertToBinary(array[k - 1], n);

	}

	private static String convertToBinary(Integer integer, int n) {
		
		StringBuilder sb = new StringBuilder();
		for (int i = n - 1; i >= 0; i--) {
			if(((integer >> i) & 1) > 0) {
				sb.append("1");
			} else {
				sb.append("0");
			}
		}
		return sb.toString();
	}

	public static class FacebookComparator implements Comparator<Integer> {

		public int compare(Integer a, Integer b) {

			if (a == null && b == null) {
				return 0;
			} else if (a == null || b == null) {
				return (a != null) ? 1 : -1;
			} else {
				int num1 = getNumberOfOneBits(a);
				int num2 = getNumberOfOneBits(b);

				if (num1 != num2) {
					return num1 < num2 ? -1 : 1;
				} else {
					return (a < b) ? -1 : 1;
				}
			}

		}

		public static int getNumberOfOneBits(int value) {

			int num = 0;
			for (int i = 0; i < 10; i++) {
				if (((value >> i) & 1) > 0) {
					num++;
				}
			}
			return num;
		}

	}

}
